package com.bfly.core.enums;

/**
 * 访问角色
 * MANAGER管理后台
 * USER 注册会员角色
 * SYSTEM 系统
 *
 * @author 长沙商脉科技有限公司
 * @date 2020/3/31 16:37
 */
public enum AccessRole {
    USER(1, "用户"),
    MANAGER(2, "管理员"),
    SYSTEM(3, "系统任务");

    private int id;
    private String name;

    AccessRole(int id, String name) {
        this.id = id;
        this.name = name;
    }

    public static AccessRole getRole(int id) {
        for (AccessRole role : AccessRole.values()) {
            if (role.getId() == id) {
                return role;
            }
        }
        return null;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
